home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / btime.c < prev    next >
C/C++ Source or Header  |  2000-05-04  |  82KB  |  2,006 lines

  1. /***************************************************************************
  2.  
  3. Burger Time
  4.  
  5. driver by Zsolt Vasvari
  6.  
  7. hardware description:
  8.  
  9. Actually Lock'n'Chase is (C)1981 while Burger Time is (C)1982, so it might
  10. be more accurate to say 'Lock'n'Chase hardware'.
  11.  
  12. The bootleg called Cook Race runs on hardware similar but different. The fact
  13. that it addresses the program ROMs in the range 0500-3fff instead of the usual
  14. c000-ffff makes me suspect that it is a bootleg of the *tape system* version.
  15. Little is known about that system, but it is quite likely that it would have
  16. RAM in the range 0000-3fff and load the program there from tape.
  17.  
  18.  
  19. This hardware is pretty straightforward, but has a couple of interesting
  20. twists. There are two ports to the video and color RAMs, one normal access,
  21. and one with X and Y coordinates swapped. The sprite RAM occupies the
  22. first row of the swapped area, so it appears in the regular video RAM as
  23. the first column of on the left side.
  24.  
  25. These games don't have VBLANK interrupts, but instead an IRQ or NMI
  26. (depending on the particular board) is generated when a coin is inserted.
  27.  
  28. Some of the games also have a background playfield which, in the
  29. case of Bump 'n' Jump and Zoar, can be scrolled vertically.
  30.  
  31. These boards use two 8910's for sound, controlled by a dedicated 6502. The
  32. main processor triggers an IRQ request when writing a command to the sound
  33. CPU.
  34.  
  35. Main clock: XTAL = 12 MHz
  36. Horizontal video frequency: HSYNC = XTAL/768?? = 15.625 kHz ??
  37. Video frequency: VSYNC = HSYNC/272 = 57.44 Hz ?
  38. VBlank duration: 1/VSYNC * (24/272) = 1536 us ?
  39.  
  40.  
  41. Note on Lock'n'Chase:
  42.  
  43. The watchdog test prints "WATCHDOG TEST ER". Just by looking at the code,
  44. I can't see how it could print anything else, there is only one path it
  45. can take. Should the game reset????
  46.  
  47. ***************************************************************************/
  48.  
  49. #include "driver.h"
  50. #include "vidhrdw/generic.h"
  51. #include "cpu/m6502/m6502.h"
  52.  
  53. extern unsigned char *lnc_charbank;
  54. extern unsigned char *bnj_backgroundram;
  55. extern size_t bnj_backgroundram_size;
  56. extern unsigned char *zoar_scrollram;
  57. extern unsigned char *deco_charram;
  58.  
  59. void btime_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  60. void lnc_vh_convert_color_prom  (unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  61.  
  62. void lnc_init_machine (void);
  63.  
  64. int  btime_vh_start (void);
  65. int  bnj_vh_start (void);
  66.  
  67. void bnj_vh_stop (void);
  68.  
  69. void btime_vh_screenrefresh   (struct osd_bitmap *bitmap,int full_refresh);
  70. void cookrace_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  71. void bnj_vh_screenrefresh     (struct osd_bitmap *bitmap,int full_refresh);
  72. void lnc_vh_screenrefresh     (struct osd_bitmap *bitmap,int full_refresh);
  73. void zoar_vh_screenrefresh    (struct osd_bitmap *bitmap,int full_refresh);
  74. void disco_vh_screenrefresh   (struct osd_bitmap *bitmap,int full_refresh);
  75. void eggs_vh_screenrefresh    (struct osd_bitmap *bitmap,int full_refresh);
  76.  
  77. WRITE_HANDLER( btime_paletteram_w );
  78. WRITE_HANDLER( bnj_background_w );
  79. WRITE_HANDLER( bnj_scroll1_w );
  80. WRITE_HANDLER( bnj_scroll2_w );
  81. READ_HANDLER( btime_mirrorvideoram_r );
  82. WRITE_HANDLER( btime_mirrorvideoram_w );
  83. READ_HANDLER( btime_mirrorcolorram_r );
  84. WRITE_HANDLER( btime_mirrorcolorram_w );
  85. WRITE_HANDLER( lnc_videoram_w );
  86. WRITE_HANDLER( lnc_mirrorvideoram_w );
  87. WRITE_HANDLER( deco_charram_w );
  88.  
  89. WRITE_HANDLER( zoar_video_control_w );
  90. WRITE_HANDLER( btime_video_control_w );
  91. WRITE_HANDLER( bnj_video_control_w );
  92. WRITE_HANDLER( lnc_video_control_w );
  93. WRITE_HANDLER( disco_video_control_w );
  94.  
  95. int lnc_sound_interrupt(void);
  96.  
  97. static WRITE_HANDLER( sound_command_w );
  98.  
  99. READ_HANDLER( mmonkey_protection_r );
  100. WRITE_HANDLER( mmonkey_protection_w );
  101.  
  102.  
  103. INLINE int swap_bits_5_6(int data)
  104. {
  105.     return (data & 0x9f) | ((data & 0x20) << 1) | ((data & 0x40) >> 1);
  106. }
  107.  
  108.  
  109. static void btime_decrypt(void)
  110. {
  111.     int A,A1;
  112.     unsigned char *rom = memory_region(REGION_CPU1);
  113.     int diff = memory_region_length(REGION_CPU1) / 2;
  114.  
  115.  
  116.     /* the encryption is a simple bit rotation: 76543210 -> 65342710, but */
  117.     /* with a catch: it is only applied if the previous instruction did a */
  118.     /* memory write. Also, only opcodes at addresses with this bit pattern: */
  119.     /* xxxx xxx1 xxxx x1xx are encrypted. */
  120.  
  121.     /* get the address of the next opcode */
  122.     A = cpu_get_pc();
  123.  
  124.     /* however if the previous instruction was JSR (which caused a write to */
  125.     /* the stack), fetch the address of the next instruction. */
  126.     A1 = cpu_getpreviouspc();
  127.     if (rom[A1 + diff] == 0x20)    /* JSR $xxxx */
  128.         A = cpu_readop_arg(A1+1) + 256 * cpu_readop_arg(A1+2);
  129.  
  130.     /* If the address of the next instruction is xxxx xxx1 xxxx x1xx, decode it. */
  131.     if ((A & 0x0104) == 0x0104)
  132.     {
  133.         /* 76543210 -> 65342710 bit rotation */
  134.         rom[A + diff] = (rom[A] & 0x13) | ((rom[A] & 0x80) >> 5) | ((rom[A] & 0x64) << 1)
  135.                | ((rom[A] & 0x08) << 2);
  136.     }
  137. }
  138.  
  139. static WRITE_HANDLER( lnc_w )
  140. {
  141.     unsigned char *rom = memory_region(REGION_CPU1);
  142.     int diff = memory_region_length(REGION_CPU1) / 2;
  143.  
  144.     if      (offset <= 0x3bff)                       ;
  145.     else if (offset >= 0x3c00 && offset <= 0x3fff) { lnc_videoram_w(offset - 0x3c00,data); return; }
  146.     else if (offset >= 0x7c00 && offset <= 0x7fff) { lnc_mirrorvideoram_w(offset - 0x7c00,data); return; }
  147.     else if (offset == 0x8000)                     { return; }  /* MWA_NOP */
  148.     else if (offset == 0x8001)                     { lnc_video_control_w(0,data); return; }
  149.     else if (offset == 0x8003)                       ;
  150.     else if (offset == 0x9000)                     { return; }  /* MWA_NOP */
  151.     else if (offset == 0x9002)                     { sound_command_w(0,data); return; }
  152.     else if (offset >= 0xb000 && offset <= 0xb1ff)   ;
  153.     else logerror("CPU #%d PC %04x: warning - write %02x to unmapped memory address %04x\n",cpu_getactivecpu(),cpu_get_pc(),data,offset);
  154.  
  155.     rom[offset] = data;
  156.  
  157.     /* Swap bits 5 & 6 for opcodes */
  158.     rom[offset+diff] = swap_bits_5_6(data);
  159. }
  160.  
  161. static WRITE_HANDLER( mmonkey_w )
  162. {
  163.     unsigned char *rom = memory_region(REGION_CPU1);
  164.     int diff = memory_region_length(REGION_CPU1) / 2;
  165.  
  166.     if      (offset <= 0x3bff)                       ;
  167.     else if (offset >= 0x3c00 && offset <= 0x3fff) { lnc_videoram_w(offset - 0x3c00,data); return; }
  168.     else if (offset >= 0x7c00 && offset <= 0x7fff) { lnc_mirrorvideoram_w(offset - 0x7c00,data); return; }
  169.     else if (offset == 0x8001)                     { lnc_video_control_w(0,data); return; }
  170.     else if (offset == 0x8003)                       ;
  171.     else if (offset == 0x9000)                     { return; }  /* MWA_NOP */
  172.     else if (offset == 0x9002)                     { sound_command_w(0,data); return; }
  173.     else if (offset >= 0xb000 && offset <= 0xbfff) { mmonkey_protection_w(offset - 0xb000, data); return; }
  174.     else logerror("CPU #%d PC %04x: warning - write %02x to unmapped memory address %04x\n",cpu_getactivecpu(),cpu_get_pc(),data,offset);
  175.  
  176.     rom[offset] = data;
  177.  
  178.     /* Swap bits 5 & 6 for opcodes */
  179.     rom[offset+diff] = swap_bits_5_6(data);
  180. }
  181.  
  182. static WRITE_HANDLER( btime_w )
  183. {
  184.     unsigned char *RAM = memory_region(REGION_CPU1);
  185.  
  186.     if      (offset <= 0x07ff)                     RAM[offset] = data;
  187.     else if (offset >= 0x0c00 && offset <= 0x0c0f) btime_paletteram_w(offset - 0x0c00,data);
  188.     else if (offset >= 0x1000 && offset <= 0x13ff) videoram_w(offset - 0x1000,data);
  189.     else if (offset >= 0x1400 && offset <= 0x17ff) colorram_w(offset - 0x1400,data);
  190.     else if (offset >= 0x1800 && offset <= 0x1bff) btime_mirrorvideoram_w(offset - 0x1800,data);
  191.     else if (offset >= 0x1c00 && offset <= 0x1fff) btime_mirrorcolorram_w(offset - 0x1c00,data);
  192.     else if (offset == 0x4002)                     btime_video_control_w(0,data);
  193.     else if (offset == 0x4003)                     sound_command_w(0,data);
  194.     else if (offset == 0x4004)                     bnj_scroll1_w(0,data);
  195.     else logerror("CPU #%d PC %04x: warning - write %02x to unmapped memory address %04x\n",cpu_getactivecpu(),cpu_get_pc(),data,offset);
  196.  
  197.     btime_decrypt();
  198. }
  199.  
  200. static WRITE_HANDLER( zoar_w )
  201. {
  202.     unsigned char *RAM = memory_region(REGION_CPU1);
  203.  
  204.     if      (offset <= 0x07ff)                        RAM[offset] = data;
  205.     else if (offset >= 0x8000 && offset <= 0x83ff) videoram_w(offset - 0x8000,data);
  206.     else if (offset >= 0x8400 && offset <= 0x87ff) colorram_w(offset - 0x8400,data);
  207.     else if (offset >= 0x8800 && offset <= 0x8bff) btime_mirrorvideoram_w(offset - 0x8800,data);
  208.     else if (offset >= 0x8c00 && offset <= 0x8fff) btime_mirrorcolorram_w(offset - 0x8c00,data);
  209.     else if (offset == 0x9000)                       zoar_video_control_w(0, data);
  210.     else if (offset >= 0x9800 && offset <= 0x9803) RAM[offset] = data;
  211.     else if (offset == 0x9804)                     bnj_scroll2_w(0,data);
  212.     else if (offset == 0x9805)                     bnj_scroll1_w(0,data);
  213.     else if (offset == 0x9806)                     sound_command_w(0,data);
  214.     else logerror("CPU #%d PC %04x: warning - write %02x to unmapped memory address %04x\n",cpu_getactivecpu(),cpu_get_pc(),data,offset);
  215.  
  216.     btime_decrypt();
  217.  
  218. }
  219.  
  220. static WRITE_HANDLER( disco_w )
  221. {
  222.     unsigned char *RAM = memory_region(REGION_CPU1);
  223.  
  224.     if      (offset <= 0x04ff)                     RAM[offset] = data;
  225.     else if (offset >= 0x2000 && offset <= 0x7fff) deco_charram_w(offset - 0x2000,data);
  226.     else if (offset >= 0x8000 && offset <= 0x83ff) videoram_w(offset - 0x8000,data);
  227.     else if (offset >= 0x8400 && offset <= 0x87ff) colorram_w(offset - 0x8400,data);
  228.     else if (offset >= 0x8800 && offset <= 0x881f) RAM[offset] = data;
  229.     else if (offset == 0x9a00)                     sound_command_w(0,data);
  230.     else if (offset == 0x9c00)                     disco_video_control_w(0,data);
  231.     else logerror("CPU #%d PC %04x: warning - write %02x to unmapped memory address %04x\n",cpu_getactivecpu(),cpu_get_pc(),data,offset);
  232.  
  233.     btime_decrypt();
  234. }
  235.  
  236.  
  237. static struct MemoryReadAddress btime_readmem[] =
  238. {
  239.     { 0x0000, 0x07ff, MRA_RAM },
  240.     { 0x1000, 0x17ff, MRA_RAM },
  241.     { 0x1800, 0x1bff, btime_mirrorvideoram_r },
  242.     { 0x1c00, 0x1fff, btime_mirrorcolorram_r },
  243.     { 0x4000, 0x4000, input_port_0_r },     /* IN0 */
  244.     { 0x4001, 0x4001, input_port_1_r },     /* IN1 */
  245.     { 0x4002, 0x4002, input_port_2_r },     /* coin */
  246.     { 0x4003, 0x4003, input_port_3_r },     /* DSW1 */
  247.     { 0x4004, 0x4004, input_port_4_r },     /* DSW2 */
  248.     { 0xb000, 0xffff, MRA_ROM },
  249.     { -1 }  /* end of table */
  250. };
  251.  
  252. static struct MemoryWriteAddress btime_writemem[] =
  253. {
  254.     { 0x0000, 0xffff, btime_w },        /* override the following entries to */
  255.                                         /* support ROM decryption */
  256.     { 0x0000, 0x07ff, MWA_RAM },
  257.     { 0x0c00, 0x0c0f, btime_paletteram_w, &paletteram },
  258.     { 0x1000, 0x13ff, videoram_w, &videoram, &videoram_size },
  259.     { 0x1400, 0x17ff, colorram_w, &colorram },
  260.     { 0x1800, 0x1bff, btime_mirrorvideoram_w },
  261.     { 0x1c00, 0x1fff, btime_mirrorcolorram_w },
  262.     { 0x4000, 0x4000, MWA_NOP },
  263.     { 0x4002, 0x4002, btime_video_control_w },
  264.     { 0x4003, 0x4003, sound_command_w },
  265.     { 0x4004, 0x4004, bnj_scroll1_w },
  266.     { -1 }  /* end of table */
  267. };
  268.  
  269. static struct MemoryReadAddress cookrace_readmem[] =
  270. {
  271.     { 0x0000, 0x03ff, MRA_RAM },
  272.     { 0x0500, 0x3fff, MRA_ROM },
  273.     { 0xc000, 0xc7ff, MRA_RAM },
  274.     { 0xc800, 0xcbff, btime_mirrorvideoram_r },
  275.     { 0xcc00, 0xcfff, btime_mirrorcolorram_r },
  276.     { 0xd000, 0xd0ff, MRA_RAM },    /* background */
  277.     { 0xd100, 0xd3ff, MRA_RAM },    /* ? */
  278.     { 0xd400, 0xd7ff, MRA_RAM },    /* background? */
  279.     { 0xe000, 0xe000, input_port_3_r },     /* DSW1 */
  280.     { 0xe300, 0xe300, input_port_3_r },     /* mirror address used on high score name enter */
  281.                                             /* screen */
  282.     { 0xe001, 0xe001, input_port_4_r },     /* DSW2 */
  283.     { 0xe002, 0xe002, input_port_0_r },     /* IN0 */
  284.     { 0xe003, 0xe003, input_port_1_r },     /* IN1 */
  285.     { 0xe004, 0xe004, input_port_2_r },     /* coin */
  286.     { 0xfff9, 0xffff, MRA_ROM },
  287.     { -1 }  /* end of table */
  288. };
  289.  
  290. static struct MemoryWriteAddress cookrace_writemem[] =
  291. {
  292.     { 0x0000, 0x03ff, MWA_RAM },
  293.     { 0x0500, 0x3fff, MWA_ROM },
  294.     { 0xc000, 0xc3ff, videoram_w, &videoram, &videoram_size },
  295.     { 0xc400, 0xc7ff, colorram_w, &colorram },
  296.     { 0xc800, 0xcbff, btime_mirrorvideoram_w },
  297.     { 0xcc00, 0xcfff, btime_mirrorcolorram_w },
  298.     { 0xd000, 0xd0ff, MWA_RAM },    /* background? */
  299.     { 0xd100, 0xd3ff, MWA_RAM },    /* ? */
  300.     { 0xd400, 0xd7ff, MWA_RAM, &bnj_backgroundram, &bnj_backgroundram_size },
  301.     { 0xe000, 0xe000, bnj_video_control_w },
  302.     { 0xe001, 0xe001, sound_command_w },
  303. #if 0
  304.     { 0x4004, 0x4004, bnj_scroll1_w },
  305. #endif
  306.     { 0xfff9, 0xffff, MWA_ROM },
  307.     { -1 }  /* end of table */
  308. };
  309.  
  310. static struct MemoryReadAddress zoar_readmem[] =
  311. {
  312.     { 0x0000, 0x07ff, MRA_RAM },
  313.     { 0x9800, 0x9800, input_port_3_r },     /* DSW 1 */
  314.     { 0x9801, 0x9801, input_port_4_r },     /* DSW 2 */
  315.     { 0x9802, 0x9802, input_port_0_r },     /* IN 0 */
  316.     { 0x9803, 0x9803, input_port_1_r },     /* IN 1 */
  317.     { 0x9804, 0x9804, input_port_2_r },     /* coin */
  318.     { 0xd000, 0xffff, MRA_ROM },
  319.     { -1 }  /* end of table */
  320. };
  321.  
  322. static struct MemoryWriteAddress zoar_writemem[] =
  323. {
  324.     { 0x0000, 0xffff, zoar_w },        /* override the following entries to */
  325.                                     /* support ROM decryption */
  326.     { 0x0000, 0x07ff, MWA_RAM },
  327.     { 0x8000, 0x83ff, videoram_w, &videoram, &videoram_size },
  328.     { 0x8400, 0x87ff, colorram_w, &colorram },
  329.     { 0x8800, 0x8bff, btime_mirrorvideoram_w },
  330.     { 0x8c00, 0x8fff, btime_mirrorcolorram_w },
  331.     { 0x9000, 0x9000, zoar_video_control_w },
  332.     { 0x9800, 0x9803, MWA_RAM, &zoar_scrollram },
  333.     { 0x9805, 0x9805, bnj_scroll2_w },
  334.     { 0x9805, 0x9805, bnj_scroll1_w },
  335.     { 0x9806, 0x9806, sound_command_w },
  336.   /*{ 0x9807, 0x9807, MWA_RAM }, */ /* Marked as ACK on schematics (Board 2 Pg 5) */
  337.     { -1 }  /* end of table */
  338. };
  339.  
  340. static struct MemoryReadAddress lnc_readmem[] =
  341. {
  342.     { 0x0000, 0x3fff, MRA_RAM },
  343.     { 0x7c00, 0x7fff, btime_mirrorvideoram_r },
  344.     { 0x8000, 0x8000, input_port_3_r },     /* DSW1 */
  345.     { 0x8001, 0x8001, input_port_4_r },     /* DSW2 */
  346.     { 0x9000, 0x9000, input_port_0_r },     /* IN0 */
  347.     { 0x9001, 0x9001, input_port_1_r },     /* IN1 */
  348.     { 0x9002, 0x9002, input_port_2_r },     /* coin */
  349.     { 0xb000, 0xb1ff, MRA_RAM },
  350.     { 0xc000, 0xffff, MRA_ROM },
  351.     { -1 }  /* end of table */
  352. };
  353.  
  354. static struct MemoryWriteAddress lnc_writemem[] =
  355. {
  356.     { 0x0000, 0xffff, lnc_w },      /* override the following entries to */
  357.                                     /* support ROM decryption */
  358.     { 0x0000, 0x3bff, MWA_RAM },
  359.     { 0x3c00, 0x3fff, lnc_videoram_w, &videoram, &videoram_size },
  360.     { 0x7800, 0x7bff, colorram_w, &colorram },  /* this is just here to initialize the pointer */
  361.     { 0x7c00, 0x7fff, lnc_mirrorvideoram_w },
  362.     { 0x8000, 0x8000, MWA_NOP },            /* ??? */
  363.     { 0x8001, 0x8001, lnc_video_control_w },
  364.     { 0x8003, 0x8003, MWA_RAM, &lnc_charbank },
  365.     { 0x9000, 0x9000, MWA_NOP },            /* IRQ ACK ??? */
  366.     { 0x9002, 0x9002, sound_command_w },
  367.     { 0xb000, 0xb1ff, MWA_RAM },
  368.     { -1 }  /* end of table */
  369. };
  370.  
  371.  
  372. static struct MemoryReadAddress mmonkey_readmem[] =
  373. {
  374.     { 0x0000, 0x3fff, MRA_RAM },
  375.     { 0x7c00, 0x7fff, btime_mirrorvideoram_r },
  376.     { 0x8000, 0x8000, input_port_3_r },     /* DSW1 */
  377.     { 0x8001, 0x8001, input_port_4_r },     /* DSW2 */
  378.     { 0x9000, 0x9000, input_port_0_r },     /* IN0 */
  379.     { 0x9001, 0x9001, input_port_1_r },     /* IN1 */
  380.     { 0x9002, 0x9002, input_port_2_r },     /* coin */
  381.     { 0xb000, 0xbfff, mmonkey_protection_r },
  382.     { 0xc000, 0xffff, MRA_ROM },
  383.     { -1 }  /* end of table */
  384. };
  385.  
  386. static struct MemoryWriteAddress mmonkey_writemem[] =
  387. {
  388.     { 0x0000, 0xffff, mmonkey_w },  /* override the following entries to */
  389.                                     /* support ROM decryption */
  390.     { 0x0000, 0x3bff, MWA_RAM },
  391.     { 0x3c00, 0x3fff, lnc_videoram_w, &videoram, &videoram_size },
  392.     { 0x7800, 0x7bff, colorram_w, &colorram },  /* this is just here to initialize the pointer */
  393.     { 0x7c00, 0x7fff, lnc_mirrorvideoram_w },
  394.     { 0x8001, 0x8001, lnc_video_control_w },
  395.     { 0x8003, 0x8003, MWA_RAM, &lnc_charbank },
  396.     { 0x9000, 0x9000, MWA_NOP },            /* IRQ ACK ??? */
  397.     { 0x9002, 0x9002, sound_command_w },
  398.     { 0xb000, 0xbfff, mmonkey_protection_w },
  399.     { -1 }  /* end of table */
  400. };
  401.  
  402.  
  403. static struct MemoryReadAddress bnj_readmem[] =
  404. {
  405.     { 0x0000, 0x07ff, MRA_RAM },
  406.     { 0x1000, 0x1000, input_port_3_r },     /* DSW1 */
  407.     { 0x1001, 0x1001, input_port_4_r },     /* DSW2 */
  408.     { 0x1002, 0x1002, input_port_0_r },     /* IN0 */
  409.     { 0x1003, 0x1003, input_port_1_r },     /* IN1 */
  410.     { 0x1004, 0x1004, input_port_2_r },     /* coin */
  411.     { 0x4000, 0x47ff, MRA_RAM },
  412.     { 0x4800, 0x4bff, btime_mirrorvideoram_r },
  413.     { 0x4c00, 0x4fff, btime_mirrorcolorram_r },
  414.     { 0xa000, 0xffff, MRA_ROM },
  415.     { -1 }  /* end of table */
  416. };
  417.  
  418. static struct MemoryWriteAddress bnj_writemem[] =
  419. {
  420.     { 0x0000, 0x07ff, MWA_RAM },
  421.     { 0x1001, 0x1001, bnj_video_control_w },
  422.     { 0x1002, 0x1002, sound_command_w },
  423.     { 0x4000, 0x43ff, videoram_w, &videoram, &videoram_size },
  424.     { 0x4400, 0x47ff, colorram_w, &colorram },
  425.     { 0x4800, 0x4bff, btime_mirrorvideoram_w },
  426.     { 0x4c00, 0x4fff, btime_mirrorcolorram_w },
  427.     { 0x5000, 0x51ff, bnj_background_w, &bnj_backgroundram, &bnj_backgroundram_size },
  428.     { 0x5400, 0x5400, bnj_scroll1_w },
  429.     { 0x5800, 0x5800, bnj_scroll2_w },
  430.     { 0x5c00, 0x5c0f, btime_paletteram_w, &paletteram },
  431.     { -1 }  /* end of table */
  432. };
  433.  
  434. static struct MemoryReadAddress disco_readmem[] =
  435. {
  436.     { 0x0000, 0x04ff, MRA_RAM },
  437.     { 0x2000, 0x881f, MRA_RAM },
  438.     { 0x9000, 0x9000, input_port_2_r },     /* coin */
  439.     { 0x9200, 0x9200, input_port_0_r },     /* IN0 */
  440.     { 0x9400, 0x9400, input_port_1_r },     /* IN1 */
  441.     { 0x9800, 0x9800, input_port_3_r },     /* DSW1 */
  442.     { 0x9a00, 0x9a00, input_port_4_r },     /* DSW2 */
  443.     { 0x9c00, 0x9c00, input_port_5_r },     /* VBLANK */
  444.     { 0xa000, 0xffff, MRA_ROM },
  445.     { -1 }  /* end of table */
  446. };
  447.  
  448. static struct MemoryWriteAddress disco_writemem[] =
  449. {
  450.     { 0x0000, 0xffff, disco_w },    /* override the following entries to */
  451.                                     /* support ROM decryption */
  452.     { 0x2000, 0x7fff, deco_charram_w, &deco_charram },
  453.     { 0x8000, 0x83ff, videoram_w, &videoram, &videoram_size },
  454.     { 0x8400, 0x87ff, colorram_w, &colorram },
  455.     { 0x8800, 0x881f, MWA_RAM, &spriteram, &spriteram_size },
  456.     { 0x9a00, 0x9a00, sound_command_w },
  457.     { 0x9c00, 0x9c00, disco_video_control_w },
  458.     { -1 }  /* end of table */
  459. };
  460.  
  461.  
  462. static struct MemoryReadAddress sound_readmem[] =
  463. {
  464.     { 0x0000, 0x03ff, MRA_RAM },
  465.     { 0x0200, 0x0fff, MRA_ROM },    /* Cook Race */
  466.     { 0xa000, 0xafff, soundlatch_r },
  467.     { 0xf000, 0xffff, MRA_ROM },
  468.     { -1 }  /* end of table */
  469. };
  470.  
  471. static struct MemoryWriteAddress sound_writemem[] =
  472. {
  473.     { 0x0000, 0x03ff, MWA_RAM },
  474.     { 0x0200, 0x0fff, MWA_ROM },    /* Cook Race */
  475.     { 0x2000, 0x2fff, AY8910_write_port_0_w },
  476.     { 0x4000, 0x4fff, AY8910_control_port_0_w },
  477.     { 0x6000, 0x6fff, AY8910_write_port_1_w },
  478.     { 0x8000, 0x8fff, AY8910_control_port_1_w },
  479.     { 0xc000, 0xcfff, interrupt_enable_w },
  480.     { 0xf000, 0xffff, MWA_ROM },
  481.     { -1 }  /* end of table */
  482. };
  483.  
  484.  
  485. static struct MemoryReadAddress disco_sound_readmem[] =
  486. {
  487.     { 0x0000, 0x03ff, MRA_RAM },
  488.     { 0x8000, 0x8fff, soundlatch_r },
  489.     { 0xf000, 0xffff, MRA_ROM },
  490.     { -1 }  /* end of table */
  491. };
  492.  
  493. static struct MemoryWriteAddress disco_sound_writemem[] =
  494. {
  495.     { 0x0000, 0x03ff, MWA_RAM },
  496.     { 0x4000, 0x4fff, AY8910_write_port_0_w },
  497.     { 0x5000, 0x5fff, AY8910_control_port_0_w },
  498.     { 0x6000, 0x6fff, AY8910_write_port_1_w },
  499.     { 0x7000, 0x7fff, AY8910_control_port_1_w },
  500.     { 0x8000, 0x8fff, MWA_NOP },  /* ACK ? */
  501.     { 0xf000, 0xffff, MWA_ROM },
  502.     { -1 }  /* end of table */
  503. };
  504.  
  505.  
  506. /***************************************************************************
  507.  
  508. These games don't have VBlank interrupts.
  509. Interrupts are still used by the game, coin insertion generates an IRQ.
  510.  
  511. ***************************************************************************/
  512. static int btime_interrupt(int(*generated_interrupt)(void), int active_high)
  513. {
  514.     static int coin;
  515.     int port;
  516.  
  517.     port = readinputport(2) & 0xc0;
  518.     if (active_high) port ^= 0xc0;
  519.  
  520.     if (port != 0xc0)    /* Coin */
  521.     {
  522.         if (coin == 0)
  523.         {
  524.             coin = 1;
  525.             return generated_interrupt();
  526.         }
  527.     }
  528.     else coin = 0;
  529.  
  530.     return ignore_interrupt();
  531. }
  532.  
  533. static int btime_irq_interrupt(void)
  534. {
  535.     return btime_interrupt(interrupt, 1);
  536. }
  537.  
  538. static int zoar_irq_interrupt(void)
  539. {
  540.     return btime_interrupt(interrupt, 0);
  541. }
  542.  
  543. static int btime_nmi_interrupt(void)
  544. {
  545.     return btime_interrupt(nmi_interrupt, 0);
  546. }
  547.  
  548. static WRITE_HANDLER( sound_command_w )
  549. {
  550.     soundlatch_w(offset,data);
  551.     cpu_cause_interrupt(1,M6502_INT_IRQ);
  552. }
  553.  
  554.  
  555. INPUT_PORTS_START( btime )
  556.     PORT_START      /* IN0 */
  557.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  558.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_4WAY )
  559.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_4WAY )
  560.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_4WAY )
  561.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  562.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  563.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  564.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  565.  
  566.     PORT_START      /* IN1 */
  567.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
  568.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_4WAY | IPF_COCKTAIL )
  569.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_4WAY | IPF_COCKTAIL )
  570.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_4WAY | IPF_COCKTAIL )
  571.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  572.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  573.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  574.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  575.  
  576.     PORT_START      /* IN2 */
  577.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  578.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  579.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT )
  580.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  581.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
  582.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
  583.     PORT_BIT( 0x40, IP_ACTIVE_HIGH,IPT_COIN1 )
  584.     PORT_BIT( 0x80, IP_ACTIVE_HIGH,IPT_COIN2 )
  585.  
  586.     PORT_START      /* DSW1 */
  587.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
  588.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  589.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
  590.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
  591.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
  592.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )
  593.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  594.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
  595.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
  596.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_3C ) )
  597.     PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
  598.     PORT_DIPNAME( 0x20, 0x20, "Cross Hatch Pattern" )
  599.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  600.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  601.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) )
  602.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  603.     PORT_DIPSETTING(    0x40, DEF_STR( Cocktail ) )
  604.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK  )
  605.  
  606.     PORT_START      /* DSW2 */
  607.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) )
  608.     PORT_DIPSETTING(    0x01, "3" )
  609.     PORT_DIPSETTING(    0x00, "5" )
  610.     PORT_DIPNAME( 0x06, 0x06, DEF_STR( Bonus_Life ) )
  611.     PORT_DIPSETTING(    0x06, "10000" )
  612.     PORT_DIPSETTING(    0x04, "15000" )
  613.     PORT_DIPSETTING(    0x02, "20000"  )
  614.     PORT_DIPSETTING(    0x00, "30000"  )
  615.     PORT_DIPNAME( 0x08, 0x08, "Enemies" )
  616.     PORT_DIPSETTING(    0x08, "4" )
  617.     PORT_DIPSETTING(    0x00, "6" )
  618.     PORT_DIPNAME( 0x10, 0x10, "End of Level Pepper" )
  619.     PORT_DIPSETTING(    0x10, DEF_STR( No ) )
  620.     PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
  621.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
  622.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  623.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  624.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
  625.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  626.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  627.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
  628.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  629.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  630. INPUT_PORTS_END
  631.  
  632. INPUT_PORTS_START( cookrace )
  633.     PORT_START      /* IN0 */
  634.     PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_JOYSTICK_RIGHT | IPF_4WAY )
  635.     PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_JOYSTICK_LEFT  | IPF_4WAY )
  636.     PORT_BIT( 0x04, IP_ACTIVE_HIGH,IPT_JOYSTICK_UP    | IPF_4WAY )
  637.     PORT_BIT( 0x08, IP_ACTIVE_HIGH,IPT_JOYSTICK_DOWN  | IPF_4WAY )
  638.     PORT_BIT( 0x10, IP_ACTIVE_HIGH,IPT_BUTTON1 )
  639.     PORT_BIT( 0x20, IP_ACTIVE_HIGH,IPT_UNKNOWN )
  640.     PORT_BIT( 0x40, IP_ACTIVE_HIGH,IPT_UNUSED )
  641.     PORT_BIT( 0x80, IP_ACTIVE_HIGH,IPT_UNUSED )
  642.  
  643.     PORT_START      /* IN1 */
  644.     PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
  645.     PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_JOYSTICK_LEFT  | IPF_4WAY | IPF_COCKTAIL )
  646.     PORT_BIT( 0x04, IP_ACTIVE_HIGH,IPT_JOYSTICK_UP    | IPF_4WAY | IPF_COCKTAIL )
  647.     PORT_BIT( 0x08, IP_ACTIVE_HIGH,IPT_JOYSTICK_DOWN  | IPF_4WAY | IPF_COCKTAIL )
  648.     PORT_BIT( 0x10, IP_ACTIVE_HIGH,IPT_BUTTON1 | IPF_COCKTAIL )
  649.     PORT_BIT( 0x20, IP_ACTIVE_HIGH,IPT_UNKNOWN )
  650.     PORT_BIT( 0x40, IP_ACTIVE_HIGH,IPT_UNUSED )
  651.     PORT_BIT( 0x80, IP_ACTIVE_HIGH,IPT_UNUSED )
  652.  
  653.     PORT_START      /* IN2 */
  654.     PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_UNKNOWN )
  655.     PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_UNKNOWN )
  656.     PORT_BIT( 0x04, IP_ACTIVE_HIGH,IPT_UNKNOWN )
  657.     PORT_BIT( 0x08, IP_ACTIVE_HIGH,IPT_START1 )
  658.     PORT_BIT( 0x10, IP_ACTIVE_HIGH,IPT_START2 )
  659.     PORT_BIT( 0x20, IP_ACTIVE_HIGH,IPT_UNKNOWN )
  660.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
  661.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
  662.  
  663.     PORT_START      /* DSW1 */
  664.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
  665.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  666.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
  667.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
  668.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
  669.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )
  670.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  671.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
  672.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
  673.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_3C ) )
  674.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
  675.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  676.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  677.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
  678.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  679.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  680.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) )
  681.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  682.     PORT_DIPSETTING(    0x40, DEF_STR( Cocktail ) )
  683.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK  )
  684.  
  685.     PORT_START      /* DSW2 */
  686.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) )
  687.     PORT_DIPSETTING(    0x01, "3" )
  688.     PORT_DIPSETTING(    0x00, "5" )
  689.     PORT_DIPNAME( 0x06, 0x06, DEF_STR( Bonus_Life ) )
  690.     PORT_DIPSETTING(    0x06, "20000" )
  691.     PORT_DIPSETTING(    0x04, "30000" )
  692.     PORT_DIPSETTING(    0x02, "40000"  )
  693.     PORT_DIPSETTING(    0x00, "50000"  )
  694.     PORT_DIPNAME( 0x08, 0x08, "Enemies" )
  695.     PORT_DIPSETTING(    0x08, "4" )
  696.     PORT_DIPSETTING(    0x00, "6" )
  697.     PORT_DIPNAME( 0x10, 0x10, "End of Level Pepper" )
  698.     PORT_DIPSETTING(    0x10, DEF_STR( No ) )
  699.     PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
  700.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
  701.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  702.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  703.     PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Difficulty ) )
  704.     PORT_DIPSETTING(    0xc0, "Easy" )
  705.     PORT_DIPSETTING(    0x80, "Normal" )
  706.     PORT_DIPSETTING(    0x40, "Hard" )
  707.     PORT_DIPSETTING(    0x00, "Hardest" )
  708. INPUT_PORTS_END
  709.  
  710. INPUT_PORTS_START( zoar )
  711.     PORT_START      /* IN0 */
  712.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  713.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  714.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  715.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  716.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  717.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  718.     PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
  719.  
  720.     PORT_START      /* IN1 */
  721.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  722.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  723.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
  724.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  725.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  726.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  727.     PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
  728.  
  729.     PORT_START      /* IN2 */
  730.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  731.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  732.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 )
  733.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_COCKTAIL )
  734.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
  735.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
  736.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
  737.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
  738.  
  739.     PORT_START      /* DSW1 */
  740.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
  741.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  742.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
  743.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
  744.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
  745.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )
  746.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  747.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
  748.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
  749.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_3C ) )
  750.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )    /* almost certainly unused */
  751.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  752.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  753.     /* Service mode doesn't work because of missing ROMs */
  754.     PORT_SERVICE( 0x20, IP_ACTIVE_LOW )
  755.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) )
  756.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  757.     PORT_DIPSETTING(    0x40, DEF_STR( Cocktail ) )
  758.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK  )
  759.  
  760.     PORT_START      /* DSW2 */
  761.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) )
  762.     PORT_DIPSETTING(    0x01, "3" )
  763.     PORT_DIPSETTING(    0x00, "5" )
  764.     PORT_DIPNAME( 0x06, 0x06, DEF_STR( Bonus_Life ) )
  765.     PORT_DIPSETTING(    0x06, "5000" )
  766.     PORT_DIPSETTING(    0x04, "10000" )
  767.     PORT_DIPSETTING(    0x02, "15000"  )
  768.     PORT_DIPSETTING(    0x00, "20000"  )
  769.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Difficulty ) )
  770.     PORT_DIPSETTING(    0x08, "Easy" )
  771.     PORT_DIPSETTING(    0x00, "Hard" )
  772.     PORT_DIPNAME( 0x10, 0x00, "Weapon Select" )
  773.     PORT_DIPSETTING(    0x00, "Manual" )
  774.     PORT_DIPSETTING(    0x10, "Auto" )
  775.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )    /* These 3 switches     */
  776.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )        /* have to do with      */
  777.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )         /* coinage.             */
  778.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )    /* See code at $d234.   */
  779.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )        /* Feel free to figure  */
  780.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )         /* them out.            */
  781.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
  782.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  783.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  784. INPUT_PORTS_END
  785.  
  786. INPUT_PORTS_START( lnc )
  787.     PORT_START      /* IN0 */
  788.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  789.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_4WAY )
  790.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_4WAY )
  791.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_4WAY )
  792.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  793.     PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNKNOWN )
  794.  
  795.     PORT_START      /* IN1 */
  796.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
  797.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_4WAY | IPF_COCKTAIL )
  798.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_4WAY | IPF_COCKTAIL )
  799.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_4WAY | IPF_COCKTAIL )
  800.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  801.     PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNKNOWN )
  802.  
  803.     PORT_START      /* IN2 */
  804.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  805.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  806.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
  807.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
  808.  
  809.     PORT_START      /* DSW1 */
  810.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
  811.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  812.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
  813.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
  814.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
  815.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )
  816.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  817.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
  818.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
  819.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_3C ) )
  820.     PORT_DIPNAME( 0x30, 0x30, "Test Mode" )
  821.     PORT_DIPSETTING(    0x30, DEF_STR( Off ) )
  822.     PORT_DIPSETTING(    0x00, "RAM Test Only" )
  823.     PORT_DIPSETTING(    0x20, "Watchdog Test Only" )
  824.     PORT_DIPSETTING(    0x10, "All Tests" )
  825.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) )
  826.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  827.     PORT_DIPSETTING(    0x40, DEF_STR( Cocktail ) )
  828.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK  )
  829.  
  830.     PORT_START      /* DSW2 */
  831.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) )
  832.     PORT_DIPSETTING(    0x01, "3" )
  833.     PORT_DIPSETTING(    0x00, "5" )
  834.     PORT_DIPNAME( 0x06, 0x06, DEF_STR( Bonus_Life ) )
  835.     PORT_DIPSETTING(    0x06, "15000" )
  836.     PORT_DIPSETTING(    0x04, "20000" )
  837.     PORT_DIPSETTING(    0x02, "30000" )
  838.     PORT_DIPSETTING(    0x00, "None" )
  839.     PORT_DIPNAME( 0x08, 0x08, "Game Speed" )
  840.     PORT_DIPSETTING(    0x08, "Slow" )
  841.     PORT_DIPSETTING(    0x00, "Hard" )
  842.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unused ) )
  843.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  844.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  845.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unused ) )
  846.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  847.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  848.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unused ) )
  849.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  850.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  851.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unused ) )
  852.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  853.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  854. INPUT_PORTS_END
  855.  
  856. INPUT_PORTS_START( wtennis )
  857.     PORT_START      /* IN0 */
  858.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  859.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  860.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  861.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  862.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  863.     PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNKNOWN )
  864.  
  865.     PORT_START      /* IN1 */
  866.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  867.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  868.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
  869.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  870.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  871.     PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNKNOWN )
  872.  
  873.     PORT_START      /* IN2 */
  874.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  875.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  876.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
  877.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
  878.  
  879.     PORT_START      /* DSW1 */
  880.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_B ) )
  881.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  882.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
  883.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
  884.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
  885.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_A ) )
  886.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  887.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
  888.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
  889.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_3C ) )
  890.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
  891.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  892.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  893.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
  894.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  895.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  896.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) )
  897.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  898.     PORT_DIPSETTING(    0x40, DEF_STR( Cocktail ) )
  899.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK  )
  900.  
  901.     PORT_START      /* DSW2 */
  902.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) )
  903.     PORT_DIPSETTING(    0x01, "2" )
  904.     PORT_DIPSETTING(    0x00, "3" )
  905.     PORT_DIPNAME( 0x06, 0x06, DEF_STR( Bonus_Life ) )
  906.     PORT_DIPSETTING(    0x06, "10000" )
  907.     PORT_DIPSETTING(    0x04, "20000" )
  908.     PORT_DIPSETTING(    0x02, "30000" )
  909.     PORT_DIPSETTING(    0x00, "None" )
  910.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )   /* definately used */
  911.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  912.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  913.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unused ) )
  914.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  915.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  916.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )    /* These 3 switches     */
  917.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )        /* have to do with      */
  918.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )         /* coinage.             */
  919.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
  920.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  921.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  922.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
  923.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  924.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  925. INPUT_PORTS_END
  926.  
  927. INPUT_PORTS_START( mmonkey )
  928.     PORT_START      /* IN0 */
  929.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  930.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_4WAY )
  931.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_4WAY )
  932.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_4WAY )
  933.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  934.     PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNKNOWN )
  935.  
  936.     PORT_START      /* IN1 */
  937.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
  938.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_4WAY | IPF_COCKTAIL )
  939.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_4WAY | IPF_COCKTAIL )
  940.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_4WAY | IPF_COCKTAIL )
  941.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  942.     PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNKNOWN )
  943.  
  944.     PORT_START      /* IN2 */
  945.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  946.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  947.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
  948.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
  949.  
  950.     PORT_START      /* DSW1 */
  951.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
  952.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  953.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
  954.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
  955.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
  956.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )
  957.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  958.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
  959.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_2C ) )
  960.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_3C ) )
  961.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Free_Play ) )
  962.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  963.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  964.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unused ) )   /* almost certainly unused */
  965.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  966.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  967.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) )
  968.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  969.     PORT_DIPSETTING(    0x40, DEF_STR( Cocktail ) )
  970.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK  )
  971.  
  972.     PORT_START      /* DSW2 */
  973.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) )
  974.     PORT_DIPSETTING(    0x01, "3" )
  975.     PORT_DIPSETTING(    0x00, "5" )
  976.     PORT_DIPNAME( 0x06, 0x00, DEF_STR( Bonus_Life ) )
  977.     PORT_DIPSETTING(    0x02, "Every 15000" )
  978.     PORT_DIPSETTING(    0x04, "Every 30000" )
  979.     PORT_DIPSETTING(    0x00, "20000" )
  980.     PORT_DIPSETTING(    0x06, "None" )
  981.     PORT_DIPNAME( 0x18, 0x08, DEF_STR( Difficulty ) )
  982.     PORT_DIPSETTING(    0x18, "Easy" )
  983.     PORT_DIPSETTING(    0x08, "Medium" )
  984.     PORT_DIPSETTING(    0x10, "Hard" )
  985.     PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "Level Skip Mode", IP_KEY_NONE, IP_JOY_NONE )
  986.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unused ) )   /* almost certainly unused */
  987.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  988.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  989.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unused ) )   /* almost certainly unused */
  990.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  991.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  992.     PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
  993. INPUT_PORTS_END
  994.  
  995. INPUT_PORTS_START( bnj )
  996.     PORT_START      /* IN0 */
  997.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  998.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  999.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  1000.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  1001.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  1002.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  1003.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  1004.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  1005.  
  1006.     PORT_START      /* IN1 */
  1007.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  1008.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  1009.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
  1010.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  1011.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  1012.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  1013.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  1014.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  1015.  
  1016.     PORT_START      /* IN2 */
  1017.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_TILT )
  1018.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
  1019.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
  1020.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  1021.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  1022.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  1023.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
  1024.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
  1025.  
  1026.     PORT_START      /* DSW1 */
  1027.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
  1028.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  1029.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
  1030.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
  1031.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
  1032.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )
  1033.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  1034.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
  1035.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
  1036.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_3C ) )
  1037.     PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
  1038.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
  1039.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1040.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  1041.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) )
  1042.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  1043.     PORT_DIPSETTING(    0x40, DEF_STR( Cocktail ) )
  1044.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK  )
  1045.  
  1046.     PORT_START      /* DSW2 */
  1047.     PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNKNOWN )
  1048.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) )
  1049.     PORT_DIPSETTING(    0x01, "3" )
  1050.     PORT_DIPSETTING(    0x00, "5" )
  1051.     PORT_DIPNAME( 0x06, 0x06, DEF_STR( Bonus_Life ) )
  1052.     PORT_DIPSETTING(    0x06, "Every 30000" )
  1053.     PORT_DIPSETTING(    0x04, "Every 70000" )
  1054.     PORT_DIPSETTING(    0x02, "20000 Only"  )
  1055.     PORT_DIPSETTING(    0x00, "30000 Only"  )
  1056.     PORT_DIPNAME( 0x08, 0x00, "Allow Continue" )
  1057.     PORT_DIPSETTING(    0x08, DEF_STR( No ) )
  1058.     PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
  1059.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Difficulty ) )
  1060.     PORT_DIPSETTING(    0x10, "Easy" )
  1061.     PORT_DIPSETTING(    0x00, "Hard" )
  1062.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
  1063.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1064.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  1065.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
  1066.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1067.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  1068.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
  1069.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1070.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  1071. INPUT_PORTS_END
  1072.  
  1073. INPUT_PORTS_START( disco )
  1074.     PORT_START      /* IN0 */
  1075.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  1076.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_4WAY )
  1077.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_4WAY )
  1078.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_4WAY )
  1079.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  1080.     PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_UNUSED )
  1081.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START1 )
  1082.  
  1083.     PORT_START      /* IN1 */
  1084.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
  1085.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_4WAY | IPF_COCKTAIL )
  1086.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_4WAY | IPF_COCKTAIL )
  1087.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_4WAY | IPF_COCKTAIL )
  1088.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
  1089.     PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_UNUSED )
  1090.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START2 )
  1091.  
  1092.     PORT_START      /* IN2 */
  1093.     PORT_BIT( 0x1f, IP_ACTIVE_LOW, IPT_UNUSED )
  1094.     PORT_BIT( 0x40, IP_ACTIVE_HIGH,IPT_COIN1 )
  1095.     PORT_BIT( 0x80, IP_ACTIVE_HIGH,IPT_COIN2 )
  1096.  
  1097.     PORT_START      /* DSW1 */
  1098.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_A ) )
  1099.     PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
  1100.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  1101.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
  1102.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
  1103.     PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coin_B ) )
  1104.     PORT_DIPSETTING(    0x0c, DEF_STR( 2C_1C ) )
  1105.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  1106.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_2C ) )
  1107.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_3C ) )
  1108.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
  1109.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1110.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  1111.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
  1112.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1113.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  1114.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) )
  1115.     PORT_DIPSETTING(    0x40, DEF_STR( Upright ) )
  1116.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  1117.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
  1118.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1119.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  1120.  
  1121.     PORT_START      /* DSW2 */
  1122.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Lives ) )
  1123.     PORT_DIPSETTING(    0x00, "3" )
  1124.     PORT_DIPSETTING(    0x01, "5" )
  1125.     PORT_DIPNAME( 0x06, 0x00, DEF_STR( Bonus_Life ) )
  1126.     PORT_DIPSETTING(    0x00, "10000" )
  1127.     PORT_DIPSETTING(    0x02, "20000" )
  1128.     PORT_DIPSETTING(    0x04, "30000" )
  1129.     PORT_DIPSETTING(    0x06, "None" )
  1130.     PORT_DIPNAME( 0x08, 0x00, "Music Weapons" )
  1131.     PORT_DIPSETTING(    0x00, "5" )
  1132.     PORT_DIPSETTING(    0x08, "8" )
  1133.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
  1134.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1135.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  1136.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
  1137.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1138.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  1139.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
  1140.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1141.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  1142.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
  1143.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1144.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  1145.  
  1146.     PORT_START      /* VBLANK */
  1147.     PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED )
  1148.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
  1149. INPUT_PORTS_END
  1150.  
  1151.  
  1152. static struct GfxLayout charlayout =
  1153. {
  1154.     8,8,    /* 8*8 characters */
  1155.     1024,   /* 1024 characters */
  1156.     3,      /* 3 bits per pixel */
  1157.     { 2*1024*8*8, 1024*8*8, 0 },    /* the bitplanes are separated */
  1158.     { 0, 1, 2, 3, 4, 5, 6, 7 },
  1159.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  1160.     8*8     /* every char takes 8 consecutive bytes */
  1161. };
  1162.  
  1163. static struct GfxLayout spritelayout =
  1164. {
  1165.     16,16,  /* 16*16 sprites */
  1166.     256,    /* 256 sprites */
  1167.     3,      /* 3 bits per pixel */
  1168.     { 2*256*16*16, 256*16*16, 0 },  /* the bitplanes are separated */
  1169.     { 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7,
  1170.       0, 1, 2, 3, 4, 5, 6, 7 },
  1171.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  1172.       8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
  1173.     32*8    /* every sprite takes 32 consecutive bytes */
  1174. };
  1175.  
  1176. static struct GfxLayout zoar_spritelayout =
  1177. {
  1178.     16,16,  /* 16*16 sprites */
  1179.     128,    /* 256 sprites */
  1180.     3,      /* 3 bits per pixel */
  1181.     { 2*128*16*16, 128*16*16, 0 },  /* the bitplanes are separated */
  1182.     { 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7,
  1183.       0, 1, 2, 3, 4, 5, 6, 7 },
  1184.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  1185.       8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
  1186.     32*8    /* every sprite takes 32 consecutive bytes */
  1187. };
  1188.  
  1189. static struct GfxLayout btime_tilelayout =
  1190. {
  1191.     16,16,  /* 16*16 characters */
  1192.     64,    /* 64 characters */
  1193.     3,      /* 3 bits per pixel */
  1194.     {  2*64*16*16, 64*16*16, 0 },    /* the bitplanes are separated */
  1195.     { 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7,
  1196.       0, 1, 2, 3, 4, 5, 6, 7 },
  1197.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  1198.       8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
  1199.     32*8    /* every tile takes 32 consecutive bytes */
  1200. };
  1201.  
  1202. static struct GfxLayout cookrace_tilelayout =
  1203. {
  1204.     8,8,  /* 8*8 characters */
  1205.     256,    /* 256 characters */
  1206.     3,      /* 3 bits per pixel */
  1207.     {  2*256*8*8, 256*8*8, 0 },    /* the bitplanes are separated */
  1208.     { 0, 1, 2, 3, 4, 5, 6, 7 },
  1209.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  1210.     8*8    /* every tile takes 8 consecutive bytes */
  1211. };
  1212.  
  1213. static struct GfxLayout bnj_tilelayout =
  1214. {
  1215.     16,16,  /* 16*16 characters */
  1216.     64, /* 64 characters */
  1217.     3,  /* 3 bits per pixel */
  1218.     { 2*64*16*16+4, 0, 4 },
  1219.     { 3*16*8+0, 3*16*8+1, 3*16*8+2, 3*16*8+3, 2*16*8+0, 2*16*8+1, 2*16*8+2, 2*16*8+3,
  1220.       16*8+0, 16*8+1, 16*8+2, 16*8+3, 0, 1, 2, 3 },
  1221.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  1222.       8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
  1223.     64*8    /* every tile takes 64 consecutive bytes */
  1224. };
  1225.  
  1226. static struct GfxDecodeInfo btime_gfxdecodeinfo[] =
  1227. {
  1228.     { REGION_GFX1, 0, &charlayout,          0, 1 }, /* char set #1 */
  1229.     { REGION_GFX1, 0, &spritelayout,        0, 1 }, /* sprites */
  1230.     { REGION_GFX2, 0, &btime_tilelayout,    8, 1 }, /* background tiles */
  1231.     { -1 } /* end of array */
  1232. };
  1233.  
  1234. static struct GfxDecodeInfo cookrace_gfxdecodeinfo[] =
  1235. {
  1236.     { REGION_GFX1, 0, &charlayout,          0, 1 }, /* char set #1 */
  1237.     { REGION_GFX1, 0, &spritelayout,        0, 1 }, /* sprites */
  1238.     { REGION_GFX2, 0, &cookrace_tilelayout, 8, 1 }, /* background tiles */
  1239.     { -1 } /* end of array */
  1240. };
  1241.  
  1242. static struct GfxDecodeInfo lnc_gfxdecodeinfo[] =
  1243. {
  1244.     { REGION_GFX1, 0, &charlayout,          0, 1 },     /* char set #1 */
  1245.     { REGION_GFX1, 0, &spritelayout,        0, 1 },     /* sprites */
  1246.     { -1 } /* end of array */
  1247. };
  1248.  
  1249. static struct GfxDecodeInfo bnj_gfxdecodeinfo[] =
  1250. {
  1251.     { REGION_GFX1, 0, &charlayout,          0, 1 }, /* char set #1 */
  1252.     { REGION_GFX1, 0, &spritelayout,        0, 1 }, /* sprites */
  1253.     { REGION_GFX2, 0, &bnj_tilelayout,      8, 1 }, /* background tiles */
  1254.     { -1 } /* end of array */
  1255. };
  1256.  
  1257. static struct GfxDecodeInfo zoar_gfxdecodeinfo[] =
  1258. {
  1259.     { REGION_GFX1, 0, &charlayout,          0, 8 }, /* char set #1 */
  1260.     { REGION_GFX4, 0, &zoar_spritelayout,   0, 8 }, /* sprites */
  1261.     { REGION_GFX2, 0, &btime_tilelayout,    0, 8 }, /* background tiles */
  1262.     { -1 } /* end of array */
  1263. };
  1264.  
  1265. static struct GfxDecodeInfo disco_gfxdecodeinfo[] =
  1266. {
  1267.     { 0, 0x2000, &charlayout,          0, 4 }, /* char set #1 */
  1268.     { 0, 0x2000, &spritelayout,        0, 4 }, /* sprites */
  1269.     { -1 } /* end of array */
  1270. };
  1271.  
  1272.  
  1273.  
  1274. static struct AY8910interface ay8910_interface =
  1275. {
  1276.     2,      /* 2 chips */
  1277.     1500000,        /* 1.5 MHz ? (hand tuned) */
  1278.     { 23, 23 },
  1279.     { 0 },
  1280.     { 0 },
  1281.     { 0 },
  1282.     { 0 }
  1283. };
  1284.  
  1285. /********************************************************************
  1286. *
  1287. *  Machine Driver macro
  1288. *  ====================
  1289. *
  1290. *  Abusing the pre-processor.
  1291. *
  1292. ********************************************************************/
  1293.  
  1294. #define cookrace_vh_convert_color_prom   btime_vh_convert_color_prom
  1295. #define bnj_vh_convert_color_prom        0
  1296. #define wtennis_vh_convert_color_prom    lnc_vh_convert_color_prom
  1297. #define mmonkey_vh_convert_color_prom    lnc_vh_convert_color_prom
  1298. #define zoar_vh_convert_color_prom       btime_vh_convert_color_prom
  1299. #define disco_vh_convert_color_prom      btime_vh_convert_color_prom
  1300.  
  1301. #define wtennis_vh_screenrefresh    eggs_vh_screenrefresh
  1302. #define mmonkey_vh_screenrefresh    eggs_vh_screenrefresh
  1303.  
  1304. #define wtennis_readmem            lnc_readmem
  1305.  
  1306. #define wtennis_writemem        lnc_writemem
  1307.  
  1308. #define btime_sound_readmem        sound_readmem
  1309. #define cookrace_sound_readmem    sound_readmem
  1310. #define lnc_sound_readmem        sound_readmem
  1311. #define wtennis_sound_readmem    sound_readmem
  1312. #define mmonkey_sound_readmem    sound_readmem
  1313. #define bnj_sound_readmem        sound_readmem
  1314. #define zoar_sound_readmem        sound_readmem
  1315.  
  1316. #define btime_sound_writemem    sound_writemem
  1317. #define cookrace_sound_writemem    sound_writemem
  1318. #define lnc_sound_writemem        sound_writemem
  1319. #define wtennis_sound_writemem    sound_writemem
  1320. #define mmonkey_sound_writemem    sound_writemem
  1321. #define bnj_sound_writemem        sound_writemem
  1322. #define zoar_sound_writemem        sound_writemem
  1323.  
  1324. #define btime_init_machine     0
  1325. #define cookrace_init_machine  0
  1326. #define bnj_init_machine       0
  1327. #define wtennis_init_machine   lnc_init_machine
  1328. #define mmonkey_init_machine   lnc_init_machine
  1329. #define zoar_init_machine      0
  1330. #define disco_init_machine     0
  1331.  
  1332. #define cookrace_vh_start  btime_vh_start
  1333. #define zoar_vh_start      btime_vh_start
  1334. #define lnc_vh_start       btime_vh_start
  1335. #define wtennis_vh_start   btime_vh_start
  1336. #define mmonkey_vh_start   btime_vh_start
  1337. #define disco_vh_start     btime_vh_start
  1338.  
  1339. #define btime_vh_stop      generic_vh_stop
  1340. #define cookrace_vh_stop   generic_vh_stop
  1341. #define zoar_vh_stop       generic_vh_stop
  1342. #define lnc_vh_stop        generic_vh_stop
  1343. #define wtennis_vh_stop    generic_vh_stop
  1344. #define mmonkey_vh_stop    generic_vh_stop
  1345. #define disco_vh_stop      generic_vh_stop
  1346.  
  1347.  
  1348. #define MACHINE_DRIVER(GAMENAME, CLOCK, MAIN_IRQ, SOUND_IRQ, GFX, COLOR)   \
  1349.                                                                     \
  1350. static struct MachineDriver machine_driver_##GAMENAME =             \
  1351. {                                                                   \
  1352.     /* basic machine hardware */                                    \
  1353.     {                                                                \
  1354.         {                                                              \
  1355.             CPU_M6502,                                              \
  1356.             CLOCK,                                                    \
  1357.             GAMENAME##_readmem,GAMENAME##_writemem,0,0,             \
  1358.             MAIN_IRQ,1                                              \
  1359.         },                                                            \
  1360.         {                                                            \
  1361.             CPU_M6502 | CPU_AUDIO_CPU,                              \
  1362.             500000, /* 500 kHz */                                   \
  1363.             GAMENAME##_sound_readmem,GAMENAME##_sound_writemem,0,0, \
  1364.             SOUND_IRQ,16   /* IRQs are triggered by the main CPU */ \
  1365.         }                                                           \
  1366.     },                                                              \
  1367.     57, 3072,        /* frames per second, vblank duration */       \
  1368.     1,      /* 1 CPU slice per frame - interleaving is forced when a sound command is written */ \
  1369.     GAMENAME##_init_machine,                                           \
  1370.                                                                     \
  1371.     /* video hardware */                                            \
  1372.     32*8, 32*8, { 1*8, 31*8-1, 1*8, 31*8-1 },                       \
  1373.     GFX,                                                            \
  1374.     COLOR,COLOR,                                                    \
  1375.     GAMENAME##_vh_convert_color_prom,                               \
  1376.                                                                     \
  1377.     VIDEO_TYPE_RASTER|VIDEO_MODIFIES_PALETTE,                       \
  1378.     0,                                                              \
  1379.     GAMENAME##_vh_start,                                            \
  1380.     GAMENAME##_vh_stop,                                             \
  1381.     GAMENAME##_vh_screenrefresh,                                       \
  1382.                                                                     \
  1383.     /* sound hardware */                                            \
  1384.     0,0,0,0,                                                        \
  1385.     {                                                               \
  1386.         {                                                           \
  1387.             SOUND_AY8910,                                           \
  1388.             &ay8910_interface                                       \
  1389.         }                                                           \
  1390.     }                                                               \
  1391. }
  1392.  
  1393.  
  1394. /*              NAME      CLOCK    MAIN_IRQ             SOUND_IRQ            GFX_DECODE              COLOR */
  1395.  
  1396. MACHINE_DRIVER( btime,    1500000, btime_irq_interrupt, nmi_interrupt,       btime_gfxdecodeinfo,    16);
  1397. MACHINE_DRIVER( cookrace, 1500000, btime_nmi_interrupt, nmi_interrupt,       cookrace_gfxdecodeinfo, 16);
  1398. MACHINE_DRIVER( lnc,      1500000, btime_nmi_interrupt, lnc_sound_interrupt, lnc_gfxdecodeinfo,      8);
  1399. MACHINE_DRIVER( wtennis,  1500000, btime_nmi_interrupt, nmi_interrupt,       lnc_gfxdecodeinfo,      8);
  1400. MACHINE_DRIVER( mmonkey,  1500000, btime_nmi_interrupt, nmi_interrupt,       lnc_gfxdecodeinfo,      8);
  1401. MACHINE_DRIVER( bnj,       750000, btime_nmi_interrupt, nmi_interrupt,       bnj_gfxdecodeinfo,      16);
  1402. MACHINE_DRIVER( zoar,     1500000, zoar_irq_interrupt,  nmi_interrupt,       zoar_gfxdecodeinfo,     64);
  1403. MACHINE_DRIVER( disco,     750000, btime_irq_interrupt, nmi_interrupt,       disco_gfxdecodeinfo,    32);
  1404.  
  1405.  
  1406. /***************************************************************************
  1407.  
  1408.     Game driver(s)
  1409.  
  1410. ***************************************************************************/
  1411.  
  1412. ROM_START( btime )
  1413.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  1414.     ROM_LOAD( "aa04.9b",      0xc000, 0x1000, 0x368a25b5 )
  1415.     ROM_LOAD( "aa06.13b",     0xd000, 0x1000, 0xb4ba400d )
  1416.     ROM_LOAD( "aa05.10b",     0xe000, 0x1000, 0x8005bffa )
  1417.     ROM_LOAD( "aa07.15b",     0xf000, 0x1000, 0x086440ad )
  1418.  
  1419.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  1420.     ROM_LOAD( "ab14.12h",     0xf000, 0x1000, 0xf55e5211 )
  1421.  
  1422.     ROM_REGION( 0x6000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1423.     ROM_LOAD( "aa12.7k",      0x0000, 0x1000, 0xc4617243 )    /* charset #1 */
  1424.     ROM_LOAD( "ab13.9k",      0x1000, 0x1000, 0xac01042f )
  1425.     ROM_LOAD( "ab10.10k",     0x2000, 0x1000, 0x854a872a )
  1426.     ROM_LOAD( "ab11.12k",     0x3000, 0x1000, 0xd4848014 )
  1427.     ROM_LOAD( "aa8.13k",      0x4000, 0x1000, 0x8650c788 )
  1428.     ROM_LOAD( "ab9.15k",      0x5000, 0x1000, 0x8dec15e6 )
  1429.  
  1430.     ROM_REGION( 0x1800, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1431.     ROM_LOAD( "ab00.1b",      0x0000, 0x0800, 0xc7a14485 )    /* charset #2 */
  1432.     ROM_LOAD( "ab01.3b",      0x0800, 0x0800, 0x25b49078 )
  1433.     ROM_LOAD( "ab02.4b",      0x1000, 0x0800, 0xb8ef56c3 )
  1434.  
  1435.     ROM_REGION( 0x0800, REGION_GFX3 )    /* background tilemaps */
  1436.     ROM_LOAD( "ab03.6b",      0x0000, 0x0800, 0xd26bc1f3 )
  1437. ROM_END
  1438.  
  1439. ROM_START( btime2 )
  1440.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  1441.     ROM_LOAD( "aa04.9b2",     0xc000, 0x1000, 0xa041e25b )
  1442.     ROM_LOAD( "aa06.13b",     0xd000, 0x1000, 0xb4ba400d )
  1443.     ROM_LOAD( "aa05.10b",     0xe000, 0x1000, 0x8005bffa )
  1444.     ROM_LOAD( "aa07.15b",     0xf000, 0x1000, 0x086440ad )
  1445.  
  1446.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  1447.     ROM_LOAD( "ab14.12h",     0xf000, 0x1000, 0xf55e5211 )
  1448.  
  1449.     ROM_REGION( 0x6000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1450.     ROM_LOAD( "aa12.7k",      0x0000, 0x1000, 0xc4617243 )    /* charset #1 */
  1451.     ROM_LOAD( "ab13.9k",      0x1000, 0x1000, 0xac01042f )
  1452.     ROM_LOAD( "ab10.10k",     0x2000, 0x1000, 0x854a872a )
  1453.     ROM_LOAD( "ab11.12k",     0x3000, 0x1000, 0xd4848014 )
  1454.     ROM_LOAD( "aa8.13k",      0x4000, 0x1000, 0x8650c788 )
  1455.     ROM_LOAD( "ab9.15k",      0x5000, 0x1000, 0x8dec15e6 )
  1456.  
  1457.     ROM_REGION( 0x1800, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1458.     ROM_LOAD( "ab00.1b",      0x0000, 0x0800, 0xc7a14485 )    /* charset #2 */
  1459.     ROM_LOAD( "ab01.3b",      0x0800, 0x0800, 0x25b49078 )
  1460.     ROM_LOAD( "ab02.4b",      0x1000, 0x0800, 0xb8ef56c3 )
  1461.  
  1462.     ROM_REGION( 0x0800, REGION_GFX3 )    /* background tilemaps */
  1463.     ROM_LOAD( "ab03.6b",      0x0000, 0x0800, 0xd26bc1f3 )
  1464. ROM_END
  1465.  
  1466. ROM_START( btimem )
  1467.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  1468.     ROM_LOAD( "ab05a1.12b",   0xb000, 0x1000, 0x0a98b230 )
  1469.     ROM_LOAD( "ab04.9b",      0xc000, 0x1000, 0x797e5f75 )
  1470.     ROM_LOAD( "ab06.13b",     0xd000, 0x1000, 0xc77f3f64 )
  1471.     ROM_LOAD( "ab05.10b",     0xe000, 0x1000, 0xb0d3640f )
  1472.     ROM_LOAD( "ab07.15b",     0xf000, 0x1000, 0xa142f862 )
  1473.  
  1474.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  1475.     ROM_LOAD( "ab14.12h",     0xf000, 0x1000, 0xf55e5211 )
  1476.  
  1477.     ROM_REGION( 0x6000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1478.     ROM_LOAD( "ab12.7k",      0x0000, 0x1000, 0x6c79f79f )    /* charset #1 */
  1479.     ROM_LOAD( "ab13.9k",      0x1000, 0x1000, 0xac01042f )
  1480.     ROM_LOAD( "ab10.10k",     0x2000, 0x1000, 0x854a872a )
  1481.     ROM_LOAD( "ab11.12k",     0x3000, 0x1000, 0xd4848014 )
  1482.     ROM_LOAD( "ab8.13k",      0x4000, 0x1000, 0x70b35bbe )
  1483.     ROM_LOAD( "ab9.15k",      0x5000, 0x1000, 0x8dec15e6 )
  1484.  
  1485.     ROM_REGION( 0x1800, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1486.     ROM_LOAD( "ab00.1b",      0x0000, 0x0800, 0xc7a14485 )    /* charset #2 */
  1487.     ROM_LOAD( "ab01.3b",      0x0800, 0x0800, 0x25b49078 )
  1488.     ROM_LOAD( "ab02.4b",      0x1000, 0x0800, 0xb8ef56c3 )
  1489.  
  1490.     ROM_REGION( 0x0800, REGION_GFX3 )    /* background tilemaps */
  1491.     ROM_LOAD( "ab03.6b",      0x0000, 0x0800, 0xd26bc1f3 )
  1492. ROM_END
  1493.  
  1494. ROM_START( cookrace )
  1495.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  1496.     /* code is in the range 0500-3fff, encrypted */
  1497.     ROM_LOAD( "1f.1",         0x0000, 0x2000, 0x68759d32 )
  1498.     ROM_LOAD( "2f.2",         0x2000, 0x2000, 0xbe7d72d1 )
  1499.     ROM_LOAD( "2k",           0xffe0, 0x0020, 0xe2553b3d )    /* reset/interrupt vectors */
  1500.  
  1501.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  1502.     ROM_LOAD( "6f.6",         0x0000, 0x1000, 0x6b8e0272 ) /* starts at 0000, not f000; 0000-01ff is RAM */
  1503.     ROM_RELOAD(               0xf000, 0x1000 )     /* for the reset/interrupt vectors */
  1504.  
  1505.     ROM_REGION( 0x6000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1506.     ROM_LOAD( "m8.7",         0x0000, 0x2000, 0xa1a0d5a6 )  /* charset #1 */
  1507.     ROM_LOAD( "m7.8",         0x2000, 0x2000, 0x1104f497 )
  1508.     ROM_LOAD( "m6.9",         0x4000, 0x2000, 0xd0d94477 )
  1509.  
  1510.     ROM_REGION( 0x1800, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1511.     ROM_LOAD( "2f.3",         0x0000, 0x0800, 0x28609a75 )  /* garbage?? */
  1512.     ROM_CONTINUE(             0x0000, 0x0800 )              /* charset #2 */
  1513.     ROM_LOAD( "4f.4",         0x0800, 0x0800, 0x7742e771 )  /* garbage?? */
  1514.     ROM_CONTINUE(             0x0800, 0x0800 )
  1515.     ROM_LOAD( "5f.5",         0x1000, 0x0800, 0x611c686f )  /* garbage?? */
  1516.     ROM_CONTINUE(             0x1000, 0x0800 )
  1517.  
  1518.     ROM_REGION( 0x0040, REGION_PROMS )
  1519.     ROM_LOAD( "f9.clr",       0x0000, 0x0020, 0xc2348c1d )    /* palette */
  1520.     ROM_LOAD( "b7",           0x0020, 0x0020, 0xe4268fa6 )    /* unknown */
  1521. ROM_END
  1522.  
  1523. /* There is a flyer with a screen shot for Lock'n'Chase at:
  1524.    http://www.gamearchive.com/flyers/video/taito/locknchase_f.jpg  */
  1525.  
  1526. ROM_START( lnc )
  1527.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  1528.     ROM_LOAD( "s3-3d",        0xc000, 0x1000, 0x1ab4f2c2 )
  1529.     ROM_LOAD( "s2-3c",        0xd000, 0x1000, 0x5e46b789 )
  1530.     ROM_LOAD( "s1-3b",        0xe000, 0x1000, 0x1308a32e )
  1531.     ROM_LOAD( "s0-3a",        0xf000, 0x1000, 0xbeb4b1fc )
  1532.  
  1533.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  1534.     ROM_LOAD( "sa-1h",        0xf000, 0x1000, 0x379387ec )
  1535.  
  1536.     ROM_REGION( 0x6000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1537.     ROM_LOAD( "s4-11l",       0x0000, 0x1000, 0xa2162a9e )
  1538.     ROM_LOAD( "s5-11m",       0x1000, 0x1000, 0x12f1c2db )
  1539.     ROM_LOAD( "s6-13l",       0x2000, 0x1000, 0xd21e2a57 )
  1540.     ROM_LOAD( "s7-13m",       0x3000, 0x1000, 0xc4f247cd )
  1541.     ROM_LOAD( "s8-15l",       0x4000, 0x1000, 0x672a92d0 )
  1542.     ROM_LOAD( "s9-15m",       0x5000, 0x1000, 0x87c8ee9a )
  1543.  
  1544.     ROM_REGION( 0x0040, REGION_PROMS )
  1545.     ROM_LOAD( "sc-5m",        0x0000, 0x0020, 0x2a976ebe )    /* palette */
  1546.     ROM_LOAD( "sb-4c",        0x0020, 0x0020, 0xa29b4204 )    /* RAS/CAS logic - not used */
  1547. ROM_END
  1548.  
  1549. ROM_START( wtennis )
  1550.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  1551.     ROM_LOAD( "tx",           0xc000, 0x0800, 0xfd343474 )
  1552.     ROM_LOAD( "t4",           0xd000, 0x1000, 0xe465d82c )
  1553.     ROM_LOAD( "t3",           0xe000, 0x1000, 0x8f090eab )
  1554.     ROM_LOAD( "t2",           0xf000, 0x1000, 0xd2f9dd30 )
  1555.  
  1556.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  1557.     ROM_LOAD( "t1",           0x0000, 0x1000, 0x40737ea7 ) /* starts at 0000, not f000; 0000-01ff is RAM */
  1558.     ROM_RELOAD(               0xf000, 0x1000 )     /* for the reset/interrupt vectors */
  1559.  
  1560.     ROM_REGION( 0x6000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1561.     ROM_LOAD( "t7",           0x0000, 0x1000, 0xaa935169 )
  1562.     ROM_LOAD( "t10",          0x1000, 0x1000, 0x746be927 )
  1563.     ROM_LOAD( "t5",           0x2000, 0x1000, 0xea1efa5d )
  1564.     ROM_LOAD( "t8",           0x3000, 0x1000, 0x542ace7b )
  1565.     ROM_LOAD( "t6",           0x4000, 0x1000, 0x4fb8565d )
  1566.     ROM_LOAD( "t9",           0x5000, 0x1000, 0x4893286d )
  1567.  
  1568.     ROM_REGION( 0x0040, REGION_PROMS )
  1569.     ROM_LOAD( "mb7051.m5",    0x0000, 0x0020, 0xf051cb28 )    /* palette */
  1570.     ROM_LOAD( "sb-4c",        0x0020, 0x0020, 0xa29b4204 )    /* RAS/CAS logic - not used */
  1571. ROM_END
  1572.  
  1573. ROM_START( mmonkey )
  1574.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  1575.     ROM_LOAD( "mmonkey.e4",   0xc000, 0x1000, 0x8d31bf6a )
  1576.     ROM_LOAD( "mmonkey.d4",   0xd000, 0x1000, 0xe54f584a )
  1577.     ROM_LOAD( "mmonkey.b4",   0xe000, 0x1000, 0x399a161e )
  1578.     ROM_LOAD( "mmonkey.a4",   0xf000, 0x1000, 0xf7d3d1e3 )
  1579.  
  1580.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  1581.     ROM_LOAD( "mmonkey.h1",   0xf000, 0x1000, 0x5bcb2e81 )
  1582.  
  1583.     ROM_REGION( 0x6000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1584.     ROM_LOAD( "mmonkey.l11",  0x0000, 0x1000, 0xb6aa8566 )
  1585.     ROM_LOAD( "mmonkey.m11",  0x1000, 0x1000, 0x6cc4d0c4 )
  1586.     ROM_LOAD( "mmonkey.l13",  0x2000, 0x1000, 0x2a343b7e )
  1587.     ROM_LOAD( "mmonkey.m13",  0x3000, 0x1000, 0x0230b50d )
  1588.     ROM_LOAD( "mmonkey.l14",  0x4000, 0x1000, 0x922bb3e1 )
  1589.     ROM_LOAD( "mmonkey.m14",  0x5000, 0x1000, 0xf943e28c )
  1590.  
  1591.     ROM_REGION( 0x0040, REGION_PROMS )
  1592.     ROM_LOAD( "mmi6331.m5",   0x0000, 0x0020, 0x55e28b32 )    /* palette */
  1593.     ROM_LOAD( "sb-4c",        0x0020, 0x0020, 0xa29b4204 )    /* RAS/CAS logic - not used */
  1594. ROM_END
  1595.  
  1596. ROM_START( brubber )
  1597.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  1598.     /* a000-bfff space for the service ROM */
  1599.     ROM_LOAD( "brubber.12c",  0xc000, 0x2000, 0xb5279c70 )
  1600.     ROM_LOAD( "brubber.12d",  0xe000, 0x2000, 0xb2ce51f5 )
  1601.  
  1602.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  1603.     ROM_LOAD( "bnj6c.bin",    0xf000, 0x1000, 0x8c02f662 )
  1604.  
  1605.     ROM_REGION( 0x6000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1606.     ROM_LOAD( "bnj4e.bin",    0x0000, 0x2000, 0xb864d082 )
  1607.     ROM_LOAD( "bnj4f.bin",    0x2000, 0x2000, 0x6c31d77a )
  1608.     ROM_LOAD( "bnj4h.bin",    0x4000, 0x2000, 0x5824e6fb )
  1609.  
  1610.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1611.     ROM_LOAD( "bnj10e.bin",   0x0000, 0x1000, 0xf4e9eb49 )
  1612.     ROM_LOAD( "bnj10f.bin",   0x1000, 0x1000, 0xa9ffacb4 )
  1613. ROM_END
  1614.  
  1615. ROM_START( bnj )
  1616.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  1617.     ROM_LOAD( "bnj12b.bin",   0xa000, 0x2000, 0xba3e3801 )
  1618.     ROM_LOAD( "bnj12c.bin",   0xc000, 0x2000, 0xfb3a2cdd )
  1619.     ROM_LOAD( "bnj12d.bin",   0xe000, 0x2000, 0xb88bc99e )
  1620.  
  1621.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  1622.     ROM_LOAD( "bnj6c.bin",    0xf000, 0x1000, 0x8c02f662 )
  1623.  
  1624.     ROM_REGION( 0x6000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1625.     ROM_LOAD( "bnj4e.bin",    0x0000, 0x2000, 0xb864d082 )
  1626.     ROM_LOAD( "bnj4f.bin",    0x2000, 0x2000, 0x6c31d77a )
  1627.     ROM_LOAD( "bnj4h.bin",    0x4000, 0x2000, 0x5824e6fb )
  1628.  
  1629.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1630.     ROM_LOAD( "bnj10e.bin",   0x0000, 0x1000, 0xf4e9eb49 )
  1631.     ROM_LOAD( "bnj10f.bin",   0x1000, 0x1000, 0xa9ffacb4 )
  1632. ROM_END
  1633.  
  1634. ROM_START( caractn )
  1635.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  1636.     /* a000-bfff space for the service ROM */
  1637.     ROM_LOAD( "brubber.12c",  0xc000, 0x2000, 0xb5279c70 )
  1638.     ROM_LOAD( "caractn.a6",   0xe000, 0x2000, 0x1d6957c4 )
  1639.  
  1640.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  1641.     ROM_LOAD( "bnj6c.bin",    0xf000, 0x1000, 0x8c02f662 )
  1642.  
  1643.     ROM_REGION( 0x6000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1644.     ROM_LOAD( "caractn.a0",   0x0000, 0x2000, 0xbf3ea732 )
  1645.     ROM_LOAD( "caractn.a1",   0x2000, 0x2000, 0x9789f639 )
  1646.     ROM_LOAD( "caractn.a2",   0x4000, 0x2000, 0x51dcc111 )
  1647.  
  1648.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1649.     ROM_LOAD( "bnj10e.bin",   0x0000, 0x1000, 0xf4e9eb49 )
  1650.     ROM_LOAD( "bnj10f.bin",   0x1000, 0x1000, 0xa9ffacb4 )
  1651. ROM_END
  1652.  
  1653. ROM_START( zoar )
  1654.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  1655.     ROM_LOAD( "zoar15",       0xd000, 0x1000, 0x1f0cfdb7 )
  1656.     ROM_LOAD( "zoar16",       0xe000, 0x1000, 0x7685999c )
  1657.     ROM_LOAD( "zoar17",       0xf000, 0x1000, 0x619ea867 )
  1658.  
  1659.     ROM_REGION( 0x10000, REGION_CPU2 )      /* 64k for the audio CPU */
  1660.     ROM_LOAD( "zoar09",       0xf000, 0x1000, 0x18d96ff1 )
  1661.  
  1662.     ROM_REGION( 0x6000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1663.     ROM_LOAD( "zoar00",       0x0000, 0x1000, 0xfd2dcb64 )
  1664.     ROM_LOAD( "zoar01",       0x1000, 0x1000, 0x74d3ca48 )
  1665.     ROM_LOAD( "zoar03",       0x2000, 0x1000, 0x77b7df14 )
  1666.     ROM_LOAD( "zoar04",       0x3000, 0x1000, 0x9be786de )
  1667.     ROM_LOAD( "zoar06",       0x4000, 0x1000, 0x07638c71 )
  1668.     ROM_LOAD( "zoar07",       0x5000, 0x1000, 0xf4710f25 )
  1669.  
  1670.     ROM_REGION( 0x1800, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1671.     ROM_LOAD( "zoar10",       0x0000, 0x0800, 0xaa8bcab8 )
  1672.     ROM_LOAD( "zoar11",       0x0800, 0x0800, 0xdcdad357 )
  1673.     ROM_LOAD( "zoar12",       0x1000, 0x0800, 0xed317e40 )
  1674.  
  1675.     ROM_REGION( 0x1000, REGION_GFX3 )    /* background tilemaps */
  1676.     ROM_LOAD( "zoar13",       0x0000, 0x1000, 0x8fefa960 )
  1677.  
  1678.     ROM_REGION( 0x3000, REGION_GFX4 | REGIONFLAG_DISPOSE )
  1679.     ROM_LOAD( "zoar02",       0x0000, 0x1000, 0xd8c3c122 )
  1680.     ROM_LOAD( "zoar05",       0x1000, 0x1000, 0x05dc6b09 )
  1681.     ROM_LOAD( "zoar08",       0x2000, 0x1000, 0x9a148551 )
  1682.  
  1683.     ROM_REGION( 0x0040, REGION_PROMS )
  1684.     ROM_LOAD( "z20-1l",       0x0000, 0x0020, 0xa63f0a07 )
  1685.     ROM_LOAD( "z21-1l",       0x0020, 0x0020, 0x5e1e5788 )
  1686. ROM_END
  1687.  
  1688. ROM_START( disco )
  1689.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  1690.     ROM_LOAD( "disco.w5",     0xa000, 0x1000, 0xb2c87b78 )
  1691.     ROM_LOAD( "disco.w4",     0xb000, 0x1000, 0xad7040ee )
  1692.     ROM_LOAD( "disco.w3",     0xc000, 0x1000, 0x12fb4f08 )
  1693.     ROM_LOAD( "disco.w2",     0xd000, 0x1000, 0x73f6fb2f )
  1694.     ROM_LOAD( "disco.w1",     0xe000, 0x1000, 0xee7b536b )
  1695.     ROM_LOAD( "disco.w0",     0xf000, 0x1000, 0x7c26e76b )
  1696.  
  1697.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  1698.     ROM_LOAD( "disco.w6",     0xf000, 0x1000, 0xd81e781e )
  1699.  
  1700.     /* no gfx1 */
  1701.  
  1702.     ROM_REGION( 0x0020, REGION_PROMS )
  1703.     ROM_LOAD( "disco.clr",    0x0000, 0x0020, 0xa393f913 )
  1704. ROM_END
  1705.  
  1706.  
  1707. static READ_HANDLER( wtennis_reset_hack_r )
  1708. {
  1709.     unsigned char *RAM = memory_region(REGION_CPU1);
  1710.  
  1711.     /* Otherwise the game goes into test mode and there is no way out that I
  1712.        can see.  I'm not sure how it can work, it probably somehow has to do
  1713.        with the tape system */
  1714.  
  1715.     RAM[0xfc30] = 0;
  1716.  
  1717.     return RAM[0xc15f];
  1718. }
  1719.  
  1720. static void init_btime(void)
  1721. {
  1722.     unsigned char *rom = memory_region(REGION_CPU1);
  1723.     int diff = memory_region_length(REGION_CPU1) / 2;
  1724.  
  1725.     memory_set_opcode_base(0,rom+diff);
  1726.  
  1727.     /* For now, just copy the RAM array over to ROM. Decryption will happen */
  1728.     /* at run time, since the CPU applies the decryption only if the previous */
  1729.     /* instruction did a memory write. */
  1730.     memcpy(rom+diff,rom,0x10000);
  1731. }
  1732.  
  1733. static void init_zoar(void)
  1734. {
  1735.     unsigned char *rom = memory_region(REGION_CPU1);
  1736.  
  1737.  
  1738.     /* At location 0xD50A is what looks like an undocumented opcode. I tried
  1739.        implementing it given what opcode 0x23 should do, but it still didn't
  1740.        work in demo mode. So this could be another protection or a bad ROM read.
  1741.        I'm NOPing it out for now. */
  1742.     memset(&rom[0xd50a],0xea,8);
  1743.  
  1744.     init_btime();
  1745. }
  1746.  
  1747. static void init_lnc(void)
  1748. {
  1749.     int A;
  1750.     unsigned char *rom = memory_region(REGION_CPU1);
  1751.     int diff = memory_region_length(REGION_CPU1) / 2;
  1752.  
  1753.     memory_set_opcode_base(0,rom+diff);
  1754.  
  1755.     /* Swap bits 5 & 6 for opcodes */
  1756.     for (A = 0;A < 0x10000;A++)
  1757.         rom[A+diff] = swap_bits_5_6(rom[A]);
  1758. }
  1759.  
  1760. static void init_wtennis(void)
  1761. {
  1762.     install_mem_read_handler(0, 0xc15f, 0xc15f, wtennis_reset_hack_r);
  1763.     init_lnc();
  1764. }
  1765.  
  1766.  
  1767.  
  1768. GAME( 1982, btime,    0,       btime,    btime,    btime,   ROT270, "Data East Corporation", "Burger Time (Data East set 1)" )
  1769. GAME( 1982, btime2,   btime,   btime,    btime,    btime,   ROT270, "Data East Corporation", "Burger Time (Data East set 2)" )
  1770. GAME( 1982, btimem,   btime,   btime,    btime,    btime,   ROT270, "Data East (Bally Midway license)", "Burger Time (Midway)" )
  1771. GAME( 1982, cookrace, btime,   cookrace, cookrace, lnc,     ROT270, "bootleg", "Cook Race" )
  1772. GAME( 1981, lnc,      0,       lnc,      lnc,      lnc,     ROT270, "Data East Corporation", "Lock'n'Chase" )
  1773. GAMEX(1982, wtennis,  0,       wtennis,  wtennis,  wtennis, ROT270, "bootleg", "World Tennis", GAME_IMPERFECT_COLORS )
  1774. GAME( 1982, mmonkey,  0,       mmonkey,  mmonkey,  lnc,     ROT270, "Technos + Roller Tron", "Minky Monkey" )
  1775. GAME( 1982, brubber,  0,       bnj,      bnj,      lnc,     ROT270, "Data East", "Burnin' Rubber" )
  1776. GAME( 1982, bnj,      brubber, bnj,      bnj,      lnc,     ROT270, "Data East USA (Bally Midway license)", "Bump 'n' Jump" )
  1777. GAME( 1983, caractn,  brubber, bnj,      bnj,      lnc,     ROT270, "bootleg", "Car Action" )
  1778. GAME( 1982, zoar,     0,       zoar,     zoar,     zoar,    ROT270, "Data East USA", "Zoar" )
  1779. GAME( 1982, disco,    0,       disco,    disco,    btime,   ROT270, "Data East", "Disco No.1" )
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785. void decocass_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  1786.  
  1787.  
  1788. READ_HANDLER( pip_r )
  1789. {
  1790.     return rand();
  1791. }
  1792.  
  1793. static struct MemoryReadAddress decocass_readmem[] =
  1794. {
  1795.     { 0x0000, 0x01ff, MRA_RAM },
  1796.     { 0xe300, 0xe300, input_port_3_r },     /* DSW1 */
  1797.     { 0xe500, 0xe502, pip_r },    /* read data from tape */
  1798. #if 0
  1799.     { 0x0000, 0x03ff, MRA_RAM },
  1800.     { 0x0500, 0x3fff, MRA_ROM },
  1801.     { 0xc000, 0xc7ff, MRA_RAM },
  1802.     { 0xc800, 0xcbff, btime_mirrorvideoram_r },
  1803.     { 0xcc00, 0xcfff, btime_mirrorcolorram_r },
  1804.     { 0xd000, 0xd0ff, MRA_RAM },    /* background */
  1805.     { 0xd100, 0xd3ff, MRA_RAM },    /* ? */
  1806.     { 0xd400, 0xd7ff, MRA_RAM },    /* background? */
  1807.     { 0xe000, 0xe000, input_port_3_r },     /* DSW1 */
  1808.     { 0xe002, 0xe002, input_port_0_r },     /* IN0 */
  1809.     { 0xe003, 0xe003, input_port_1_r },     /* IN1 */
  1810.     { 0xe004, 0xe004, input_port_2_r },     /* coin */
  1811. #endif
  1812.     { 0xf000, 0xffff, MRA_ROM },
  1813.     { -1 }  /* end of table */
  1814. };
  1815.  
  1816. static struct MemoryWriteAddress decocass_writemem[] =
  1817. {
  1818.     { 0x0000, 0x01ff, MWA_RAM },
  1819.     { 0x6000, 0xbfff, deco_charram_w, &deco_charram },
  1820.     { 0xc000, 0xc3ff, videoram_w, &videoram, &videoram_size },
  1821.     { 0xc400, 0xc7ff, colorram_w, &colorram },
  1822.     { 0xc800, 0xcbff, btime_mirrorvideoram_w },
  1823.     { 0xcc00, 0xcfff, btime_mirrorcolorram_w },
  1824.     { 0xe000, 0xe01f, btime_paletteram_w, &paletteram },    /* The "bios" doesn't write to e000 */
  1825.                                     /* but the "loading" background should be blue, not black */
  1826. #if 0
  1827.     { 0x0500, 0x3fff, MWA_ROM },
  1828.     { 0xd000, 0xd0ff, MWA_RAM, &bnj_backgroundram, &bnj_backgroundram_size },
  1829.     { 0xd000, 0xd0ff, MWA_RAM },    /* background? */
  1830.     { 0xd100, 0xd3ff, MWA_RAM },    /* ? */
  1831.     { 0xd400, 0xd7ff, MWA_RAM, &bnj_backgroundram, &bnj_backgroundram_size },
  1832.     { 0xe000, 0xe000, bnj_video_control_w },
  1833.     { 0xe001, 0xe001, sound_command_w },
  1834.     { 0x4004, 0x4004, bnj_scroll1_w },
  1835. #endif
  1836.     { 0xf000, 0xffff, MWA_ROM },
  1837.     { -1 }  /* end of table */
  1838. };
  1839.  
  1840. static struct MemoryReadAddress decocass_sound_readmem[] =
  1841. {
  1842.     { 0x0000, 0x01ff, MRA_RAM },
  1843. #if 0
  1844.     { 0xa000, 0xafff, soundlatch_r },
  1845. #endif
  1846.     { 0xf800, 0xffff, MRA_ROM },
  1847.     { -1 }  /* end of table */
  1848. };
  1849.  
  1850. static struct MemoryWriteAddress decocass_sound_writemem[] =
  1851. {
  1852.     { 0x0000, 0x01ff, MWA_RAM },
  1853.     { 0x2000, 0x2fff, AY8910_write_port_0_w },
  1854.     { 0x4000, 0x4fff, AY8910_control_port_0_w },
  1855.     { 0x6000, 0x6fff, AY8910_write_port_1_w },
  1856.     { 0x8000, 0x8fff, AY8910_control_port_1_w },
  1857. #if 0
  1858.     { 0xc000, 0xcfff, interrupt_enable_w },
  1859. #endif
  1860.     { 0xf800, 0xffff, MWA_ROM },
  1861.     { -1 }  /* end of table */
  1862. };
  1863.  
  1864. INPUT_PORTS_START( decocass )
  1865.     PORT_START      /* IN0 */
  1866.     PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_JOYSTICK_RIGHT | IPF_4WAY )
  1867.     PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_JOYSTICK_LEFT | IPF_4WAY )
  1868.     PORT_BIT( 0x04, IP_ACTIVE_HIGH,IPT_JOYSTICK_UP | IPF_4WAY )
  1869.     PORT_BIT( 0x08, IP_ACTIVE_HIGH,IPT_JOYSTICK_DOWN | IPF_4WAY )
  1870.     PORT_BIT( 0x10, IP_ACTIVE_HIGH,IPT_BUTTON1 )
  1871.     PORT_BIT( 0x20, IP_ACTIVE_HIGH,IPT_UNKNOWN )
  1872.     PORT_BIT( 0x40, IP_ACTIVE_HIGH,IPT_UNUSED )
  1873.     PORT_BIT( 0x80, IP_ACTIVE_HIGH,IPT_UNUSED )
  1874.  
  1875.     PORT_START      /* IN1 */
  1876.     PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
  1877.     PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_JOYSTICK_LEFT | IPF_4WAY | IPF_COCKTAIL )
  1878.     PORT_BIT( 0x04, IP_ACTIVE_HIGH,IPT_JOYSTICK_UP | IPF_4WAY | IPF_COCKTAIL )
  1879.     PORT_BIT( 0x08, IP_ACTIVE_HIGH,IPT_JOYSTICK_DOWN | IPF_4WAY | IPF_COCKTAIL )
  1880.     PORT_BIT( 0x10, IP_ACTIVE_HIGH,IPT_BUTTON1 | IPF_COCKTAIL )
  1881.     PORT_BIT( 0x20, IP_ACTIVE_HIGH,IPT_UNKNOWN )
  1882.     PORT_BIT( 0x40, IP_ACTIVE_HIGH,IPT_UNUSED )
  1883.     PORT_BIT( 0x80, IP_ACTIVE_HIGH,IPT_UNUSED )
  1884.  
  1885.     PORT_START      /* IN2 */
  1886.     PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_UNKNOWN )
  1887.     PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_UNKNOWN )
  1888.     PORT_BIT( 0x04, IP_ACTIVE_HIGH,IPT_UNKNOWN )
  1889.     PORT_BIT( 0x08, IP_ACTIVE_HIGH,IPT_START1 )
  1890.     PORT_BIT( 0x10, IP_ACTIVE_HIGH,IPT_START2 )
  1891.     PORT_BIT( 0x20, IP_ACTIVE_HIGH,IPT_UNKNOWN )
  1892.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
  1893.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
  1894.  
  1895.     PORT_START      /* DSW1 */
  1896.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
  1897.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  1898.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
  1899.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
  1900.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
  1901.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )
  1902.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  1903.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
  1904.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
  1905.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_3C ) )
  1906.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )    /* used by the "bios" */
  1907.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1908.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  1909.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )    /* used by the "bios" */
  1910.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1911.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  1912.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) )
  1913.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  1914.     PORT_DIPSETTING(    0x40, DEF_STR( Cocktail ) )
  1915.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK  )
  1916.  
  1917.     PORT_START      /* DSW2 */
  1918.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) )
  1919.     PORT_DIPSETTING(    0x01, "3" )
  1920.     PORT_DIPSETTING(    0x00, "5" )
  1921.     PORT_DIPNAME( 0x06, 0x06, DEF_STR( Bonus_Life ) )
  1922.     PORT_DIPSETTING(    0x06, "20000" )
  1923.     PORT_DIPSETTING(    0x04, "30000" )
  1924.     PORT_DIPSETTING(    0x02, "40000"  )
  1925.     PORT_DIPSETTING(    0x00, "50000"  )
  1926.     PORT_DIPNAME( 0x08, 0x08, "Enemies" )
  1927.     PORT_DIPSETTING(    0x08, "4" )
  1928.     PORT_DIPSETTING(    0x00, "6" )
  1929.     PORT_DIPNAME( 0x10, 0x10, "End of Level Pepper" )
  1930.     PORT_DIPSETTING(    0x10, DEF_STR( No ) )
  1931.     PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
  1932.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
  1933.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1934.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  1935.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
  1936.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1937.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  1938.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
  1939.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1940.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  1941. INPUT_PORTS_END
  1942.  
  1943. static struct GfxDecodeInfo decocass_gfxdecodeinfo[] =
  1944. {
  1945.     { 0, 0x6000, &charlayout,          0, 4 }, /* char set #1 */
  1946.     { 0, 0x6000, &spritelayout,        0, 4 }, /* sprites */
  1947. //    { 0, 0x6000, &cookrace_tilelayout, 8, 1 }, /* background tiles */
  1948.     { -1 } /* end of array */
  1949. };
  1950.  
  1951. static struct MachineDriver machine_driver_decocass =
  1952. {
  1953.     /* basic machine hardware */
  1954.     {
  1955.         {
  1956.             CPU_M6502,
  1957.             1500000,    /* ? I guess it should be 750000 like in bnj */
  1958.             decocass_readmem,decocass_writemem,0,0,
  1959.             nmi_interrupt,1
  1960.         },
  1961.         {
  1962.             CPU_M6502 | CPU_AUDIO_CPU,
  1963.             500000, /* 500 kHz */
  1964.             decocass_sound_readmem,decocass_sound_writemem,0,0,
  1965. ignore_interrupt,0,//            nmi_interrupt,16   /* IRQs are triggered by the main CPU */
  1966.         }
  1967.     },
  1968.     57, 3072,        /* frames per second, vblank duration */
  1969.     1,      /* 1 CPU slice per frame - interleaving is forced when a sound command is written */ \
  1970.     0,//GAMENAME##_init_machine,
  1971.  
  1972.     /* video hardware */
  1973.     32*8, 32*8, { 1*8, 31*8-1, 1*8, 31*8-1 },
  1974.     decocass_gfxdecodeinfo,
  1975.     32,32,//COLOR,COLOR,
  1976.     0,//GAMENAME##_vh_convert_color_prom,
  1977.  
  1978.     VIDEO_TYPE_RASTER|VIDEO_MODIFIES_PALETTE,
  1979.     0,
  1980.     btime_vh_start,
  1981.     generic_vh_stop,
  1982.     decocass_vh_screenrefresh,
  1983.  
  1984.     /* sound hardware */
  1985.     0,0,0,0,
  1986.     {
  1987.         {
  1988.             SOUND_AY8910,
  1989.             &ay8910_interface
  1990.         }
  1991.     }
  1992. };
  1993.  
  1994. ROM_START( decocass )
  1995.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  1996.     ROM_LOAD( "rms8.cpu",     0xf000, 0x1000, 0x23d929b7 )
  1997. /* the following two are just about the same stuff as the one above */
  1998. //    ROM_LOAD( "dsp3.p0b",     0xf000, 0x0800, 0xb67a91d9 )
  1999. //    ROM_LOAD( "dsp3.p1b",     0xf800, 0x0800, 0x3bfff5f3 )
  2000.  
  2001.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  2002.     ROM_LOAD( "rms8.snd",     0xf800, 0x0800, 0xb66b2c2a )
  2003. ROM_END
  2004.  
  2005. GAME( ????, decocass, 0, decocass, decocass, lnc, ROT270, "?????", "decocass" )
  2006.